package com.laizhenghua.share.rule.controller;

import com.laizhenghua.share.common.core.domain.R;
import com.laizhenghua.share.rule.api.domain.entity.FeeRule;
import com.laizhenghua.share.rule.service.FeeRuleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * TODO
 *
 * @Description
 * @Author laizh
 * @Date 2025/10/15 20:59
 **/
@Tag(name = "费用规则API")
@RestController
@RequestMapping("/fee-rule")
public class FeeRuleController {
    private final FeeRuleService feeRuleService;

    @Autowired
    public FeeRuleController(FeeRuleService feeRuleService) {
        this.feeRuleService = feeRuleService;
    }

    @PostMapping("/list")
    @Operation(summary = "批量获取费用规则信息")
    public R<List<FeeRule>> list(@RequestBody List<Long> ids) {
        List<FeeRule> feeRules = feeRuleService.listByIds(ids);
        return R.ok(feeRules);
    }

    @GetMapping("/detail/{id}")
    @Operation(summary = "获取费用规则详情")
    public R<FeeRule> detail(@PathVariable("id") Long id) {
        FeeRule feeRule = feeRuleService.getById(id);
        return R.ok(feeRule);
    }
}
